﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace VehicleManagement.Models
{
    //CREATE TABLE Accident
    //(
    //    AccidentID int PRIMARY KEY IDENTITY(1,1),
    //    CarID int REFERENCES CarInfo(CarID),
    //    DriverID int REFERENCES DriverInfo(DriverID),
    //    [Date] DateTime NOT NULL,
    //    Cost decimal(18,2) DEFAULT 0,
    //    Location nvarchar(30),
    //    Accident nvarchar(30),
    //    Blame nvarchar(30),
    //    Reason nvarchar(30),
    //    Injurie nvarchar(30),
    //    Result nvarchar(100)
    //)

    public class Accident
    {
        public int AccidentID { get; set; }
        public int CarID { get; set; }
        public int DriverID { get; set; }

        [DisplayName("日期")]
        [Required(ErrorMessage = "日期不能为空")]
        public DateTime Date { get; set; }

        [DisplayName("事故花费")]
        [Required(ErrorMessage = "费用不能为空")]
        public decimal Cost { get; set; }

        [DisplayName("事故地点")]
        [StringLength(30, ErrorMessage = "地点不能超过30位")]
        public string Location { get; set; }

        [DisplayName("事故详情")]
        [StringLength(30, ErrorMessage = "详情不能超过30位")]
        public string AccidentDetail { get; set; }

        [DisplayName("责任")]
        [StringLength(30, ErrorMessage = "责任不能超过30位")]
        public string Blame { get; set; }

        [DisplayName("出车事由")]
        [StringLength(30, ErrorMessage = "事由不能超过30位")]
        public string Reason { get; set; }

        [DisplayName("伤亡")]
        [StringLength(30, ErrorMessage = "伤亡不能超过30位")]
        public string Injurie { get; set; }

        [DisplayName("处理结果")]
        [StringLength(30, ErrorMessage = "处理结果不能超过30位")]
        public string Result { get; set; }

        [DisplayName("车牌号")]
        public virtual string CarNumber { get; set; }

        [DisplayName("司机姓名")]
        public virtual string DriverName { get; set; }

        public virtual string CompanyName { get; set; }
    }
}